<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

namespace App\Console\Commands;

use App\Models\AdminRole;
use App\Models\AdminUser;
use Illuminate\Console\Command;

class InitSuperAdminRole extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'init:super_admin_role';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        AdminRole::query()->create([
            'name' => '超级管理员',
            'desc' => '超级管理员',
            'remark' => '超级管理员',
            'code' => '000000',
        ]);
        AdminUser::query()->create([
            'phone' => '18131588815',
            'password' => md5('123456'),
            'admin_role_id' => 1,
            'name' => '王智慧',
        ]);
        AdminUser::query()->create([
            'phone' => '18310567647',
            'password' => md5('123456'),
            'admin_role_id' => 1,
            'name' => '18310567647',
        ]);
        AdminUser::query()->create([
            'phone' => '13841251720',
            'password' => md5('123456'),
            'admin_role_id' => 1,
            'name' => '13841251720',
        ]);
        AdminUser::query()->create([
            'phone' => '15712976652',
            'password' => md5('123456'),
            'admin_role_id' => 1,
            'name' => '15712976652',
        ]);
        return 0;
    }
}
